home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / tom.swf / scripts / classes / game / Tom.as < prev   
Encoding:
Text File  |  2011-04-12  |  2.6 KB  |  118 lines

  1. package classes.game
  2. {
  3.    import classes.Main;
  4.    import flash.display.MovieClip;
  5.    import libs.kjc.KJC_enterframe;
  6.    
  7.    [Embed(source="/_assets/assets.swf", symbol="classes.game.Tom")]
  8.    public dynamic class Tom extends MovieClip
  9.    {
  10.        
  11.       
  12.       private var tx:int;
  13.       
  14.       public var hit:MovieClip;
  15.       
  16.       internal var id:int;
  17.       
  18.       public function Tom()
  19.       {
  20.          super();
  21.          addFrameScript(0,frame1,7,frame8,15,frame16,31,frame32,46,frame47,62,frame63,103,frame104);
  22.          reSetTom();
  23.       }
  24.       
  25.       internal function reSetTom() : void
  26.       {
  27.          this.gotoAndStop(1);
  28.          id = -1;
  29.          tx = 250;
  30.          KJC_enterframe.moveToValue(this,tx,4,"x");
  31.       }
  32.       
  33.       internal function frame1() : *
  34.       {
  35.          id = -1;
  36.       }
  37.       
  38.       internal function frame63() : *
  39.       {
  40.          this.gotoAndStop(1);
  41.       }
  42.       
  43.       internal function frame32() : *
  44.       {
  45.          this.gotoAndStop(1);
  46.       }
  47.       
  48.       internal function frame8() : *
  49.       {
  50.          this.gotoAndStop(1);
  51.       }
  52.       
  53.       internal function frame104() : *
  54.       {
  55.          this.gotoAndStop(1);
  56.       }
  57.       
  58.       internal function frame47() : *
  59.       {
  60.          this.gotoAndStop(1);
  61.       }
  62.       
  63.       internal function frame16() : *
  64.       {
  65.          this.gotoAndStop(1);
  66.       }
  67.       
  68.       internal function actionTom(param1:String) : void
  69.       {
  70.          if(id == -2)
  71.          {
  72.             return;
  73.          }
  74.          switch(param1)
  75.          {
  76.             case "LEFT":
  77.                tx -= 70;
  78.                if(tx < 40)
  79.                {
  80.                   tx = 40;
  81.                   return;
  82.                }
  83.                id = -1;
  84.                Main.playSound(4);
  85.                KJC_enterframe.moveToValue(this,tx,4,"x");
  86.                break;
  87.             case "RIGHT":
  88.                tx += 70;
  89.                if(tx > 460)
  90.                {
  91.                   tx = 460;
  92.                   return;
  93.                }
  94.                id = -1;
  95.                Main.playSound(4);
  96.                KJC_enterframe.moveToValue(this,tx,4,"x");
  97.                break;
  98.             case "Z":
  99.                id = 0;
  100.                break;
  101.             case "X":
  102.                id = 1;
  103.                break;
  104.             case "C":
  105.                id = 2;
  106.                break;
  107.             case "FAIL":
  108.                Main.playSound(3);
  109.                id = -2;
  110.                break;
  111.             default:
  112.                return;
  113.          }
  114.          this.gotoAndPlay(param1);
  115.       }
  116.    }
  117. }
  118.